import {
    tasksList,
    uploadCaseFile,
    deleteCaseFile,
    deleteUploadCaseFile,
    dealCase
} from '@/api/punish'

export default defineStore('usePunish', {
    state: () => ({}),
    getters: {},
    actions: {
        //行政许可任务列表
        async getCaseTaskList(params) {
            let url = $globalRequestUrl({
                url: tasksList,
            })
            try {
                const rep = await $globalRequest(url, params, { method: 'POST' })
                return rep
            } catch (error) {
                return error
            }
        },

        async uploadCaseFile(params) {
            let url = $globalRequestUrl({
                url: uploadCaseFile,
            })
            try {
                const rep = await $globalRequest(url, params, { method: 'put' })
                return rep
            } catch (error) {
                return error
            }
        },
        //删除行政许可任务
        async deleteCaseFile(id) {
            let url = $globalRequestUrl({
                url: deleteCaseFile + `/${id}`,
            })
            try {
                const rep = await $globalRequest(url, {}, { method: 'DELETE' })
                return rep
            } catch (error) {
                return error
            }
        },
        //删除行政许可任务
        async deleteUploadCaseFile(id) {
            let url = $globalRequestUrl({
                url: deleteUploadCaseFile + `/${id}`,
            })
            try {
                const rep = await $globalRequest(url, {}, { method: 'DELETE' })
                return rep
            } catch (error) {
                return error
            }
        },
        async dealCase(params) {
            let url = $globalRequestUrl({
                url: dealCase,
            })
            try {
                const rep = await $globalRequest(url, params, { method: 'put' })
                return rep
            } catch (error) {
                return error
            }
        },
    },
})
